<?php
/**
 * Created by PhpStorm.
 * User: 柳迪
 * Date: 2018/7/10
 * Time: 11:01
 */

namespace app\SuperAdmin\controller;


use app\SuperAdmin\model\EnrollModel;
use think\Controller;

class MatchEnrollController extends Controller
{
    public function index()
    {
        $result=null;
        if(input('keyword'))
        {
            $result=db('enroll')->alias('e')->join('match m','e.mid=m.mid')->join('users u','u.uid=e.uid')->where('m.mname','like','%'.input('keyword').'%')->paginate(100);
        }
        else
        {
            $result=db('enroll')->alias('e')->join('match m','e.mid=m.mid')->join('users u','u.uid=e.uid')->paginate(100);
        }
        $this->assign('list',$result);
        return $this->fetch();
    }

    public function delete($eid)
    {
        $enroll=EnrollModel::get($eid);
        $enroll->delete();
        $this->success('删除成功');
    }
}